//
//  MBRegisterLastController.m
//  MiBaoTu
//
//  Created by 彭鹏 on 16/9/22.
//  Copyright © 2016年 com.caesartech15. All rights reserved.
//

#import "MBRegisterLastController.h"
#import "MBSpacePerfectInformationViewController.h"
#import "MBNavController.h"
#import "MBTabBarController.h"
#import "MBLoginController.h"
@interface MBRegisterLastController ()
@property (weak, nonatomic) IBOutlet UIButton *completeleBtn;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tipsLeft;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tipsRight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *btRight;
@property (weak, nonatomic) IBOutlet UIButton *laterBt;

@end

@implementation MBRegisterLastController
//跳转到完善资料页面
- (IBAction)completeBtn:(id)sender {
    MBSpacePerfectInformationViewController *spacePerfectInVC = [[MBSpacePerfectInformationViewController alloc] init];
    spacePerfectInVC.isFromRegister = YES;
    spacePerfectInVC.formBaseViewCtrl = _formBaseViewCtrl;
    [self.navigationController pushViewController:spacePerfectInVC animated:YES];

}
//跳转到 tabBar 主界面
- (IBAction)sayLater:(id)sender {
    
    if (_formBaseViewCtrl) {
        for (UIViewController *controller in self.navigationController.viewControllers) {
            if ([_formBaseViewCtrl isEqualToString:NSStringFromClass([controller class])]) {
                [self.navigationController popToViewController:controller animated:YES];
            }
        }
    } else {
        MBTabBarController *tabBar = [[MBTabBarController alloc] init];
        [self presentViewController:tabBar animated:YES completion:nil];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNavBar];
    self.completeleBtn.layer.cornerRadius = 5.0;
    self.completeleBtn.clipsToBounds = YES;
    
    if (ISIPAD) {
        _tipsLeft.constant = (SCREEN_WIDTH-700*PERCEN)/2.;
        _tipsRight.constant = (SCREEN_WIDTH-700*PERCEN)/2.;
        _btRight.constant = (SCREEN_WIDTH-700*PERCEN)/2.;
        
        _laterBt.layer.cornerRadius = 5.f;
        _laterBt.layer.masksToBounds = YES;
        _laterBt.layer.borderColor = TINK_COLOR.CGColor;
        _laterBt.layer.borderWidth =1.f;
    }
}

- (void)onUpdateUIForView:(UIDeviceOrientation)orientation
{
    if (ISIPAD) {
        _tipsLeft.constant = (SCREEN_WIDTH-700*PERCEN)/2.;
        _tipsRight.constant = (SCREEN_WIDTH-700*PERCEN)/2.;
        _btRight.constant = (SCREEN_WIDTH-700*PERCEN)/2.;
    }
}

- (void)setupNavBar {
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"fanhui"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]style:UIBarButtonItemStylePlain target:self action:@selector(navigationBackButton)];
    
}
//返回
-(void)navigationBackButton {
    [self.navigationController popViewControllerAnimated:YES];
}
@end
